

public class Computer {
    private String name;
    private int score;
    private String result;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public int getNum(){
        while (true) {
            int num = (int) (Math.random()*10);
            if (num == 0){
                continue;
            }else {
                return num;
            }
        }
    }

    public String cpunch(int num){
        if (num%3 == 0){
            this.setResult("剪刀");
        }else if (num%3 == 1){
            this.setResult("石头");
        }else if (num%3 == 2){
            this.setResult("布");
        }else {
            this.setResult("输出错误");
        }
        return this.getResult();
    }
}

